home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 010a / csap311.zip / GETDPB.C < prev    next >
Text File  |  1990-06-19  |  774b  |  26 lines

  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <dos.h>
  4.  
  5. /*
  6.  *    GETDPB is a routine to use the undocumented PC/MS-DOS Int 21H, Func 32H
  7.  *           to obtain disk information.  This function has been verified to
  8.  *           perform correctly in all versions of PC/MS-DOS from 2.0 through
  9.  *           3.3.  Since it is heavily used by DOS programs such as CHKDSK,
  10.  *           it will prbably continue to work correctly.  This routine is used
  11.  *           to avoid problems with non-standard boot sectors.
  12.  */
  13.  
  14.  void
  15. GetDPB (int Disk, struct DpbStruct *Dpb) {
  16.     union REGS Regs;
  17.     struct SREGS SRegs;
  18.  
  19.     segread(&SRegs);
  20.     Regs.h.ah = 0x32;
  21.     if (Disk) Disk -= '@';
  22.     Regs.h.dl = Disk;
  23.     intdosx(&Regs, &Regs, &SRegs);
  24.     movedata(SRegs.ds, Regs.x.bx, FP_SEG(Dpb), FP_OFF(Dpb), 28);
  25.     }
  26.